Object.defineProperty(exports, "__esModule", {
  value: !0
}), exports.default = void 0;
var e = require("../../@babel/runtime/helpers/regeneratorRuntime"),
  t = require("../../@babel/runtime/helpers/asyncToGenerator"),
  n = require("../../config/index"),
  i = require("../../utils/index"),
  o = [{
    mode: n.typeMode.seeking,
    title: "求租"
  }, {
    mode: n.typeMode.hire,
    title: "出租"
  }, {
    mode: n.typeMode.sell,
    title: "出售"
  }, {
    mode: n.typeMode.askBuy,
    title: "求购"
  }, {
    mode: n.typeMode.recruit,
    title: "招"
  }],
  a = Behavior({
    data: {
      isActiveModify: !1,
      isShowCode: !1
    },
    methods: {
      onClickLabel: function (e) {
        var t, n = this,
          o = e.target.dataset.item;
        this.data.machineValue && o.id == (null === (t = this.data.machineValue) || void 0 === t ? void 0 : t.id) || (this.selectComponent("#form").setValues({
          machine: {
            id: o.id,
            name: o.name
          },
          brand: "",
          model: ""
        }), this.setData({
          machineValue: {
            id: o.id,
            name: o.name
          }
        }), i.operateDom.nextTick((function () {
          n.setDetail()
        })))
      },
      onBack: function () {
        $.jxAlert({
          mode: "confirm",
          hideClose: !0,
          title: "温馨提示",
          content: "您还未完善机械信息，确定要退出吗？",
          confirmText: "继续完善",
          cancelText: "下次再来"
        }).catch((function () {
          $.router.back()
        }))
      },
      onPhoneChange: function (e) {
        var t = this.data.userInfo.tel;
        e.detail.value && e.detail.value !== t ? this.setData({
          isShowCode: !0
        }) : this.setData({
          isShowCode: !1
        })
      },
      onDetailchange: function () {
        this.setData({
          isActiveModify: !0
        })
      },
      onMachineChange: function (e) {
        var t, n = this;
        this.selectComponent("#form").setValues({
          brand: "",
          model: ""
        }), this.setData({
          machineValue: (null === (t = e.detail) || void 0 === t ? void 0 : t.value) || null
        }), i.operateDom.nextTick((function () {
          n.setDetail()
        }))
      },
      onBrandChange: function () {
        var e = this;
        this.selectComponent("#form").setValues({
          model: ""
        }), i.operateDom.nextTick((function () {
          e.setDetail()
        }))
      },
      onModelChange: function () {
        var e = this;
        i.operateDom.nextTick((function () {
          e.setDetail()
        }))
      },
      onLocationChange: function () {
        var e = this;
        i.operateDom.nextTick((function () {
          e.setDetail()
        }))
      },
      onTypeChange: function () {
        var e = this;
        i.operateDom.nextTick((function () {
          e.setDetail()
        }))
      },
      setDetail: function () {
        var i = this;
        return t(e().mark((function t() {
          var a, l, r, c, s, u, d, m, h, f, p, v;
          return e().wrap((function (e) {
            for (;;) switch (e.prev = e.next) {
              case 0:
                return a = i.data, l = a.uu_id, r = a.isActiveModify, c = a.mode, e.next = 6, i.selectComponent("#form").getValues();
              case 6:
                s = e.sent, u = s.address, d = s.brand, m = s.model, h = s.machine, f = s.type, l || r || !c || (p = "", u && (d || m || h) && c != n.typeMode.recruit ? (p += (u.province_text || "") + (u.city_text || ""), p += o.find((function (e) {
                  return e.mode == c
                })).title, p += null != d && d.name ? " ".concat(null == d ? void 0 : d.name) : "", p += null != m && m.name ? " ".concat(null == m ? void 0 : m.name) : "", p += null != h && h.name ? " ".concat(null == h ? void 0 : h.name) : "") : u && f && c == n.typeMode.recruit && (p += u.province_text + u.city_text, p += o.find((function (e) {
                  return e.mode == c
                })).title, null != (v = null == f ? void 0 : f.map((function (e) {
                  return null == e ? void 0 : e.name
                }))) && v.length && (p += v.join("、"))), i.selectComponent("#form").setValues({
                  detail: p
                }));
              case 13:
              case "end":
                return e.stop()
            }
          }), t)
        })))()
      }
    }
  });
exports.default = a;